package com.itchen.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * 密码工具类
 */
public class PasswordUtil {

    private static final String SALT = "your_salt"; // 盐值，用于增强密码安全性


    /**
     * 加密密码
     */
    public static String encrypt(String password) {
        BCryptPasswordEncoder Encoder = new BCryptPasswordEncoder();
        return Encoder.encode(password);
    }

    /**
     * 验证密码
     */
    public static boolean verify(String rawPassword, String encryptedPassword) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        return encoder.matches(rawPassword, encryptedPassword);
    }
}